# chunk_reading_log_file.py

def read_log_file_in_chunks(file_path, chunk_size=1024*1024):
    try:
        with open(file_path, 'r') as file:
            while True:
                chunk = file.read(chunk_size)
                if not chunk:
                    break
                yield chunk
    except FileNotFoundError:
        print(f"错误：文件'{file_path}'不存在")
    except Exception as e:
        print(f"读取文件时发生错误：{e}")

# 测试
log_file = "large_log_file.log"
for chunk in read_log_file_in_chunks(log_file):
    print(chunk)